package org.example.comp_algorithm_back.controller;

import jakarta.annotation.Resource;
import org.example.comp_algorithm_back.common.CommonResponse;
import org.example.comp_algorithm_back.service.TestService;
import org.example.comp_algorithm_back.vo.DataVo;
import org.example.comp_algorithm_back.vo.WordNumVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
public class TestController {
    //该控制器用来进行算法数据测试的请求
    @Resource
    private TestService testService;


    //找出本日志中词频最高的词
    @GetMapping("/wordFrequency/{num}")
    public CommonResponse<ArrayList<WordNumVo>> getWordFrequency(@PathVariable("num") int num){
        return testService.getWordFrequency(num);
    }

    //不同日志长度的用时测试
    @GetMapping("/analysis/num")
    public CommonResponse<ArrayList<DataVo>> getAnalysisNum() throws Exception {
        return testService.getNumAnalysis();
    }

    //不同多线程的用时测试
    @GetMapping("/analysis/thread")
    public CommonResponse<ArrayList<DataVo>> getAnalysisThread(){
        return testService.getThreadAnalysis();
    }
}
